package com.example.ch4_1activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.EditText;

public class AnotherActivity2 extends AppCompatActivity {


    private EditText edtMsg;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_another2);

        edtMsg = findViewById(R.id.tv_msg);
        //获取intent对象
        Intent intent = getIntent();
        //获取封装在intent对象中的数据
        String msg = intent.getStringExtra("msg");
        //把数据显示到编辑框中
        edtMsg.setText(msg);


    }
}